home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / • Other Platforms / PCCTS / h / antlr.h next >
Encoding:
C/C++ Source or Header  |  1994-09-14  |  15.8 KB  |  585 lines  |  [TEXT/MPS ]

  1. /* antlr.h
  2.  *
  3.  * SOFTWARE RIGHTS
  4.  *
  5.  * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
  6.  * Set (PCCTS) -- PCCTS is in the public domain.  An individual or
  7.  * company may do whatever they wish with source code distributed with
  8.  * PCCTS or the code generated by PCCTS, including the incorporation of
  9.  * PCCTS, or its output, into commerical software.
  10.  * 
  11.  * We encourage users to develop software with PCCTS.  However, we do ask
  12.  * that credit is given to us for developing PCCTS.  By "credit",
  13.  * we mean that if you incorporate our source code into one of your
  14.  * programs (commercial product, research project, or otherwise) that you
  15.  * acknowledge this fact somewhere in the documentation, research report,
  16.  * etc...  If you like PCCTS and have developed a nice tool with the
  17.  * output, please mention that you developed it using PCCTS.  In
  18.  * addition, we ask that this header remain intact in our source code.
  19.  * As long as these guidelines are kept, we expect to continue enhancing
  20.  * this system and expect to make other tools available as they are
  21.  * completed.
  22.  *
  23.  * ANTLR 1.23
  24.  * Terence Parr
  25.  * Parr Research Corporation
  26.  * with Purdue University and AHPCRC, University of Minnesota
  27.  * 1989-1994
  28.  */
  29. #ifndef ANTLR_H
  30. #define ANTLR_H
  31.  
  32. #include "config.h"
  33.  
  34. /*
  35.  * Define all of the stack setup and manipulation of $i, #i variables.
  36.  *
  37.  *    Notes:
  38.  *        The type 'Attrib' must be defined before entry into this .h file.
  39.  */
  40.  
  41. #ifdef __USE_PROTOS
  42. #include <stdlib.h>
  43. #else
  44. #ifdef VAXC
  45. #include <stdlib.h>
  46. #else
  47. #include <malloc.h>
  48. #endif
  49. #endif
  50. #include <string.h>
  51.  
  52. typedef unsigned char SetWordType;
  53.  
  54. typedef char ANTLRChar;
  55.  
  56.                         /* G u e s s  S t u f f */
  57.  
  58. #ifdef ZZCAN_GUESS
  59. #ifndef ZZINF_LOOK
  60. #define ZZINF_LOOK
  61. #endif
  62. #endif
  63.  
  64. #ifdef ZZCAN_GUESS
  65. typedef struct _zzjmp_buf {
  66.             jmp_buf state;
  67.         } zzjmp_buf;
  68. #endif
  69.  
  70.  
  71. /* can make this a power of 2 for more efficient lookup */
  72. #ifndef ZZLEXBUFSIZE
  73. #define ZZLEXBUFSIZE    2000
  74. #endif
  75.  
  76. #define zzOvfChk                                                        \
  77.             if ( zzasp <= 0 )                                           \
  78.             {                                                           \
  79.                 fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__);        \
  80.                 exit(-1);                                               \
  81.             }
  82.  
  83. #ifndef ZZA_STACKSIZE
  84. #define ZZA_STACKSIZE    400
  85. #endif
  86. #ifndef ZZAST_STACKSIZE
  87. #define ZZAST_STACKSIZE    400
  88. #endif
  89.  
  90. #ifndef zzfailed_pred
  91. #define zzfailed_pred(_p)    \
  92.     fprintf(stderr, "semantic error; failed predicate: '%s'\n",_p)
  93. #endif
  94.  
  95. #ifdef LL_K
  96. #define LOOKAHEAD                                                \
  97.     int zztokenLA[LL_K];                                        \
  98.     char zztextLA[LL_K][ZZLEXBUFSIZE];                            \
  99.     int zzlap = 0, zzlabase=0; /* labase only used for DEMAND_LOOK */
  100. #else
  101. #define LOOKAHEAD                                                \
  102.     int zztoken;
  103. #endif
  104.  
  105. #ifndef zzcr_ast
  106. #define zzcr_ast(ast,attr,tok,text)
  107. #endif
  108.  
  109. #ifdef DEMAND_LOOK
  110. #define DemandLookData  int zzdirty=1;
  111. #else
  112. #define DemandLookData
  113. #endif
  114.  
  115.                         /* S t a t e  S t u f f */
  116.  
  117. #ifdef ZZCAN_GUESS
  118. #define zzGUESS_BLOCK        zzantlr_state zzst; int zzrv;
  119. #define zzGUESS                zzsave_antlr_state(&zzst); \
  120.                             zzguessing = 1; \
  121.                             zzrv = setjmp(zzguess_start.state);
  122. #define zzGUESS_FAIL        longjmp(zzguess_start.state, 1)
  123. #define zzGUESS_DONE        zzrestore_antlr_state(&zzst);
  124. #define zzNON_GUESS_MODE    if ( !zzguessing )
  125. #define zzGuessData                                     \
  126.             zzjmp_buf zzguess_start;                    \
  127.             int zzguessing;
  128. #else
  129. #define zzGUESS_BLOCK
  130. #define zzGUESS
  131. #define zzGUESS_FAIL
  132. #define zzGUESS_DONE
  133. #define zzNON_GUESS_MODE
  134. #define zzGuessData
  135. #endif
  136.  
  137. typedef struct _zzantlr_state {
  138. #ifdef ZZCAN_GUESS
  139.             zzjmp_buf guess_start;
  140.             int guessing;
  141. #endif
  142.             int asp;
  143.             int ast_sp;
  144. #ifdef ZZINF_LOOK
  145.             int inf_lap;    /* not sure we need to save this one */
  146.             int inf_labase;
  147.             int inf_last;
  148. #endif
  149. #ifdef DEMAND_LOOK
  150.             int dirty;
  151. #endif
  152.  
  153. #ifdef LL_K
  154.             int tokenLA[LL_K];
  155.             char textLA[LL_K][ZZLEXBUFSIZE];
  156.             int lap;
  157.             int labase;
  158. #else
  159.             int token;
  160.             char text[ZZLEXBUFSIZE];
  161. #endif
  162.         } zzantlr_state;
  163.  
  164.  
  165.                  /* I n f i n i t e  L o o k a h e a d */
  166.  
  167.  
  168. #ifdef ZZINF_LOOK
  169. #define InfLookData    \
  170.     int *zzinf_tokens;    \
  171.     char **zzinf_text;    \
  172.     char *zzinf_text_buffer;    \
  173.     int *zzinf_line;        \
  174.     int zzinf_labase;    \
  175.     int zzinf_last;
  176. #else
  177. #define InfLookData
  178. #endif
  179.  
  180. #ifdef ZZINF_LOOK
  181.  
  182. #ifndef ZZINF_DEF_TEXT_BUFFER_SIZE
  183. #define ZZINF_DEF_TEXT_BUFFER_SIZE        20000
  184. #endif
  185. #ifndef ZZINF_DEF_TOKEN_BUFFER_SIZE
  186. #define ZZINF_DEF_TOKEN_BUFFER_SIZE        2000
  187. #endif
  188. /* WARNING!!!!!!
  189.  * ZZINF_BUFFER_TEXT_CHUNK_SIZE must be > sizeof(text) largest possible token.
  190.  */
  191. #ifndef ZZINF_BUFFER_TEXT_CHUNK_SIZE
  192. #define ZZINF_BUFFER_TEXT_CHUNK_SIZE    5000
  193. #endif
  194. #ifndef ZZINF_BUFFER_TOKEN_CHUNK_SIZE
  195. #define ZZINF_BUFFER_TOKEN_CHUNK_SIZE    1000
  196. #endif
  197.  
  198. #if ZZLEXBUFSIZE > ZZINF_BUFFER_TEXT_CHUNK_SIZE
  199. #define ZZINF_BUFFER_TEXT_CHUNK_SIZE    ZZLEXBUFSIZE+5
  200. #endif
  201.  
  202. /* make inf_look user-access macros */
  203. #ifdef LL_K
  204. #define ZZINF_LA_VALID(i)    (((zzinf_labase+i-1)-LL_K+1) <= zzinf_last)
  205. #define ZZINF_LA(i)            zzinf_tokens[(zzinf_labase+i-1)-LL_K+1]
  206. #define ZZINF_LATEXT(i)        zzinf_text[(zzinf_labase+i-1)-LL_K+1]
  207. /* #define ZZINF_LINE(i)       zzinf_line[(zzinf_labase+i-1)-LL_K+1]*/
  208. #else
  209. #define ZZINF_LA_VALID(i)    (((zzinf_labase+i-1)) <= zzinf_last)
  210. #define ZZINF_LA(i)            zzinf_tokens[(zzinf_labase+i-1)]
  211. #define ZZINF_LATEXT(i)        zzinf_text[(zzinf_labase+i-1)]
  212. #endif
  213.  
  214. #define inf_zzgettok _inf_zzgettok()
  215. extern void _inf_zzgettok();
  216.  
  217. #endif    /* ZZINF_LOOK */
  218.  
  219.  
  220. #ifdef LL_K
  221.  
  222. #ifdef __USE_PROTOS
  223. #define ANTLR_INFO                                                \
  224.     Attrib zzempty_attr() {static Attrib a; return a;}            \
  225.     Attrib zzconstr_attr(int _tok, char *_text)\
  226.         {Attrib a; zzcr_attr((&a),_tok,_text); return a;}        \
  227.     int zzasp=ZZA_STACKSIZE;                                    \
  228.     char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
  229.     Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData                \
  230.     InfLookData                                                 \
  231.     zzGuessData
  232. #else
  233. #define ANTLR_INFO                                                \
  234.     Attrib zzempty_attr() {static Attrib a; return a;}            \
  235.     Attrib zzconstr_attr(_tok, _text) int _tok; char *_text;\
  236.         {Attrib a; zzcr_attr((&a),_tok,_text); return a;}        \
  237.     int zzasp=ZZA_STACKSIZE;                                    \
  238.     char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
  239.     Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData                \
  240.     InfLookData                                                 \
  241.     zzGuessData
  242. #endif
  243.  
  244. #else
  245.  
  246. #ifdef __USE_PROTOS
  247. #define ANTLR_INFO                                                \
  248.     Attrib zzempty_attr() {static Attrib a; return a;}            \
  249.     Attrib zzconstr_attr(int _tok, char *_text)\
  250.         {Attrib a; zzcr_attr((&a),_tok,_text); return a;}        \
  251.     int zzasp=ZZA_STACKSIZE;                                    \
  252.     char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
  253.     Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData                \
  254.     InfLookData                                                 \
  255.     zzGuessData
  256. #else
  257. #define ANTLR_INFO                                                \
  258.     Attrib zzempty_attr() {static Attrib a; return a;}            \
  259.     Attrib zzconstr_attr(_tok, _text) int _tok; char *_text;\
  260.         {Attrib a; zzcr_attr((&a),_tok,_text); return a;}        \
  261.     int zzasp=ZZA_STACKSIZE;                                    \
  262.     char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \
  263.     Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData                \
  264.     InfLookData                                                 \
  265.     zzGuessData
  266. #endif
  267.     
  268. #endif /* LL_k */
  269.  
  270.  
  271. #ifdef ZZINF_LOOK
  272.  
  273. #ifdef LL_K
  274. #ifdef DEMAND_LOOK
  275. #define zzPrimeLookAhead  {zzdirty=LL_K; zzlap = zzlabase = 0;}
  276. #else
  277. #define zzPrimeLookAhead  {zzlap = zzlabase = 0; zzfill_inf_look();\
  278.                           {int _i;  for(_i=1;_i<=LL_K; _i++)        \
  279.                                         {zzCONSUME;} zzlap = zzlabase = 0;}}
  280. #endif
  281.  
  282. #else /* LL_K */
  283.  
  284. #ifdef DEMAND_LOOK
  285. #define zzPrimeLookAhead  zzfill_inf_look(); zzdirty=1
  286. #else
  287. #define zzPrimeLookAhead  zzfill_inf_look(); inf_zzgettok
  288.  
  289. #endif
  290. #endif    /* LL_K */
  291.  
  292. #else    /* ZZINF_LOOK */
  293.  
  294. #ifdef LL_K
  295. #ifdef DEMAND_LOOK
  296. #define zzPrimeLookAhead  {zzdirty=LL_K; zzlap = zzlabase = 0;}
  297. #else
  298. #define zzPrimeLookAhead  {int _i; zzlap = 0; for(_i=1;_i<=LL_K; _i++)        \
  299.                                         {zzCONSUME;} zzlap = 0;}
  300. #endif
  301.  
  302. #else
  303.  
  304. #ifdef DEMAND_LOOK
  305. #define zzPrimeLookAhead  zzdirty=1
  306. #else
  307. #define zzPrimeLookAhead  zzgettok()
  308. #endif
  309. #endif    /* LL_K */
  310.  
  311. #endif    /* ZZINF_LOOK */
  312.  
  313.  
  314. #ifdef LL_K
  315. #define zzenterANTLRs(s)                            \
  316.         zzlextext = &(zztextLA[0][0]); zzrdstr( s ); zzPrimeLookAhead;
  317. #define zzenterANTLRf(f)                            \
  318.         zzlextext = &(zztextLA[0][0]); zzrdfunc( f ); zzPrimeLookAhead;
  319. #define zzenterANTLR(f)                            \
  320.         zzlextext = &(zztextLA[0][0]); zzrdstream( f ); zzPrimeLookAhead;
  321. #ifdef ZZINF_LOOK
  322. #define zzleaveANTLR(f)            free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  323. #define zzleaveANTLRf(f)           free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  324. #define zzleaveANTLRs(f)        free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  325. #else
  326. #define zzleaveANTLR(f)
  327. #define zzleaveANTLRf(f)
  328. #define zzleaveANTLRs(f)
  329. #endif
  330.  
  331. #else
  332.  
  333. #define zzenterANTLRs(s)                            \
  334.         {static char zztoktext[ZZLEXBUFSIZE];   \
  335.         zzlextext = zztoktext; zzrdstr( s ); zzPrimeLookAhead;}
  336. #define zzenterANTLRf(f)                            \
  337.         {static char zztoktext[ZZLEXBUFSIZE];    \
  338.         zzlextext = zztoktext; zzrdfunc( f ); zzPrimeLookAhead;}
  339. #define zzenterANTLR(f)                            \
  340.         {static char zztoktext[ZZLEXBUFSIZE];    \
  341.         zzlextext = zztoktext; zzrdstream( f ); zzPrimeLookAhead;}
  342. #ifdef ZZINF_LOOK
  343. #define zzleaveANTLR(f)            free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  344. #define zzleaveANTLRf(f)           free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  345. #define zzleaveANTLRs(f)        free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line);
  346. #else
  347. #define zzleaveANTLR(f)
  348. #define zzleaveANTLRf(f)
  349. #define zzleaveANTLRs(f)
  350. #endif
  351.  
  352. #endif
  353.  
  354. #define ANTLR(st, f)    zzbufsize = ZZLEXBUFSIZE;    \
  355.                         zzenterANTLR(f);            \
  356.                         st; ++zzasp;                \
  357.                         zzleaveANTLR(f);
  358.                         
  359. #define ANTLRm(st, f, _m)    zzbufsize = ZZLEXBUFSIZE;    \
  360.                         zzmode(_m);                \
  361.                         zzenterANTLR(f);            \
  362.                         st; ++zzasp;                \
  363.                         zzleaveANTLR(f);
  364.                         
  365. #define ANTLRf(st, f)    zzbufsize = ZZLEXBUFSIZE;    \
  366.                         zzenterANTLRf(f);            \
  367.                         st; ++zzasp;                \
  368.                         zzleaveANTLRf(f);
  369.  
  370. #define ANTLRs(st, s)   zzbufsize = ZZLEXBUFSIZE;    \
  371.                         zzenterANTLRs(s);           \
  372.                         st; ++zzasp;                \
  373.                         zzleaveANTLRs(s);
  374.  
  375. #ifdef LL_K
  376. #define zztext        (&(zztextLA[zzlap][0]))
  377. #else
  378. #define zztext        zzlextext
  379. #endif
  380.  
  381.  
  382.                     /* A r g u m e n t  A c c e s s */
  383.  
  384. #define zzaCur            (zzaStack[zzasp])
  385. #define zzaRet            (*zzaRetPtr)
  386. #define zzaArg(v,n)        zzaStack[v-n]
  387. #define zzMakeAttr        { zzNON_GUESS_MODE {zzOvfChk; --zzasp; zzcr_attr(&(zzaStack[zzasp]),LA(1),LATEXT(1));}}
  388. #ifdef zzdef0
  389. #define zzMake0            { zzOvfChk; --zzasp; zzdef0(&(zzaStack[zzasp]));}
  390. #else
  391. #define zzMake0            { zzOvfChk; --zzasp;}
  392. #endif
  393. #define zzaPush(_v)        { zzOvfChk; zzaStack[--zzasp] = _v;}
  394. #ifndef zzd_attr
  395. #define zzREL(t)        zzasp=(t);        /* Restore state of stack */
  396. #else
  397. #define zzREL(t)        for (; zzasp<(t); zzasp++)                \
  398.                         { zzd_attr(&(zzaStack[zzasp])); }
  399. #endif
  400.  
  401. #define zzsetmatch(_es)                        \
  402.     if ( !_zzsetmatch(_es, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet) ) goto fail;
  403. #ifdef __USE_PROTOS
  404. extern int _zzsetmatch(SetWordType *, char **, char **, int *, int *, SetWordType **);
  405. #else
  406. extern int _zzsetmatch();
  407. #endif
  408.  
  409. #define zzmatch(_t)                            \
  410.     if ( !_zzmatch(_t, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet) ) goto fail;
  411. #ifdef __USE_PROTOS
  412. extern int _zzmatch(int, char **, char **, int *, int *, SetWordType **);
  413. #else
  414. extern int _zzmatch();
  415. #endif
  416.  
  417. #ifdef GENAST
  418. #define zzRULE        Attrib *zzaRetPtr = &(zzaStack[zzasp-1]);    \
  419.                     SetWordType *zzMissSet=NULL; int zzMissTok=0;        \
  420.                     int zzBadTok=0; char *zzBadText="";        \
  421.                     int zzErrk=1;                                \
  422.                     char *zzMissText=""; zzASTVars
  423. #else
  424. #define zzRULE        Attrib *zzaRetPtr = &(zzaStack[zzasp-1]);    \
  425.                     int zzBadTok=0; char *zzBadText="";        \
  426.                     int zzErrk=1;                                \
  427.                     SetWordType *zzMissSet=NULL; int zzMissTok=0; char *zzMissText=""
  428. #endif
  429.  
  430. #ifdef GENAST
  431. #define zzBLOCK(i)    int i = zzasp - 1; int zztsp = zzast_sp
  432. #define zzEXIT(i)    zzREL(i); zzastREL; zzNON_GUESS_MODE { zzastPush(*_root); }
  433. #define zzLOOP(i)    zzREL(i); zzastREL
  434. #else
  435. #define zzBLOCK(i)    int i = zzasp - 1
  436. #define zzEXIT(i)    zzREL(i)
  437. #define zzLOOP(i)    zzREL(i)
  438. #endif
  439.  
  440. #ifdef LL_K
  441.  
  442. #ifdef DEMAND_LOOK
  443. #define LOOK(_k)    {int i,stop=_k-(LL_K-zzdirty); for (i=1; i<=stop; i++)    \
  444.                     zzCONSUME;}
  445. #define zzCONSUME    {zzgettok(); zzdirty--;                            \
  446.                     zzlap = (zzlap+1)&(LL_K-1);                        \
  447.                     zzlextext = &(zztextLA[zzlap][0]);}
  448. #else
  449. #ifdef ZZINF_LOOK
  450. #define zzCONSUME    {inf_zzgettok;                                     \
  451.                     zzlap = (zzlap+1)&(LL_K-1);                        \
  452.                     zzlextext = &(zztextLA[zzlap][0]);                \
  453.                     }
  454. #else
  455. #define zzCONSUME    {zzgettok();                                     \
  456.                     zzlap = (zzlap+1)&(LL_K-1);                        \
  457.                     zzlextext = &(zztextLA[zzlap][0]);}
  458. #endif /* ZZINF_LOOK */
  459. #endif /* DEMAND_LOOK */
  460.  
  461. #else /* LL_K */
  462.  
  463. #ifdef DEMAND_LOOK
  464. #define LOOK(_k)    if ( zzdirty) zzCONSUME;
  465. #ifdef ZZINF_LOOK
  466. #define zzCONSUME    inf_zzgettok; zzdirty=0;
  467. #else
  468. #define zzCONSUME    zzgettok(); zzdirty=0;
  469. #endif /* ZZINF_LOOK */
  470.  
  471. #else  /* DEMAND_LOOK */
  472.  
  473. #ifdef ZZINF_LOOK
  474. #define zzCONSUME    inf_zzgettok
  475. #else
  476. #define zzCONSUME    zzgettok();
  477. #endif
  478.  
  479. #endif /* DEMAND_LOOK */
  480.  
  481. #endif /* LL_K */
  482.  
  483. #ifdef LL_K
  484. #define NLA            zztokenLA[zzlap&(LL_K-1)]    /* --> next LA */
  485. #define NLATEXT        zztextLA[zzlap&(LL_K-1)]    /* --> next text of LA */
  486. #ifdef DEMAND_LOOK
  487. #define LA(i)       zztokenLA[(zzlabase+(i)-1)&(LL_K-1)]
  488. #define LATEXT(i)   (&(zztextLA[(zzlabase+(i)-1)&(LL_K-1)][0]))
  489. #else
  490. #define LA(i)       zztokenLA[(zzlap+(i)-1)&(LL_K-1)]
  491. #define LATEXT(i)   (&(zztextLA[(zzlap+(i)-1)&(LL_K-1)][0]))
  492. #endif
  493. #else
  494. #define NLA            zztoken
  495. #define NLATEXT        zztext
  496. #define LA(i)       zztoken
  497. #define LATEXT(i)   zztext
  498. #endif
  499.  
  500.            /* F u n c t i o n  T r a c i n g */
  501.  
  502. #ifndef zzTRACEIN
  503. #define zzTRACEIN(r)    fprintf(stderr, "enter rule \"%s\"\n", r);
  504. #endif
  505. #ifndef zzTRACEOUT
  506. #define zzTRACEOUT(r)    fprintf(stderr, "exit rule \"%s\"\n", r);
  507. #endif
  508.  
  509. #ifdef ZZWCHAR_T
  510. #define zzchar_t wchar_t
  511. #else
  512. #define zzchar_t char
  513. #endif
  514.  
  515.                 /* E x t e r n  D e f s */
  516.  
  517. #ifdef __USE_PROTOS
  518. extern Attrib zzempty_attr();
  519. extern Attrib zzconstr_attr(int, char *);
  520. extern void zzsyn(char *, int, char *, SetWordType *, int, int, char *);
  521. extern int zzset_el(unsigned, SetWordType *);
  522. extern int zzset_deg(SetWordType *);
  523. extern void zzedecode(SetWordType *);
  524. extern void zzFAIL(int k, ...);
  525. extern void zzresynch(SetWordType *, SetWordType);
  526. extern void zzsave_antlr_state(zzantlr_state *);
  527. extern void zzrestore_antlr_state(zzantlr_state *);
  528. extern void zzfill_inf_look(void);
  529. #else
  530. extern Attrib zzempty_attr();
  531. extern Attrib zzconstr_attr();
  532. extern void zzsyn();
  533. extern int zzset_el();
  534. extern int zzset_deg();
  535. extern void zzedecode();
  536. extern void zzFAIL();
  537. extern void zzresynch();
  538. extern void zzsave_antlr_state();
  539. extern void zzrestore_antlr_state();
  540. extern void zzfill_inf_look();
  541. #endif
  542.  
  543.                 /* G l o b a l  V a r i a b l e s */
  544.  
  545. /* Define a parser; user should do a "#parser myname" in their grammar file */
  546. /*extern struct pccts_parser zzparser;*/
  547.  
  548. extern char *zztokens[];
  549. #ifdef LL_K
  550. extern int zztokenLA[];
  551. extern char zztextLA[][ZZLEXBUFSIZE];
  552. extern int zzlap;
  553. extern int zzlabase;
  554. #else
  555. extern int zztoken;
  556. #endif
  557.  
  558. extern char zzStackOvfMsg[];
  559. extern int zzasp;
  560. extern Attrib zzaStack[];
  561. #ifdef ZZINF_LOOK
  562. extern int *zzinf_tokens;
  563. extern char **zzinf_text;
  564. extern char *zzinf_text_buffer;
  565. extern int *zzinf_line;
  566. extern int zzinf_labase;
  567. extern int zzinf_last;
  568. #endif
  569. #ifdef DEMAND_LOOK
  570. extern int zzdirty;
  571. #endif
  572. #ifdef ZZCAN_GUESS
  573. extern int zzguessing;
  574. extern zzjmp_buf zzguess_start;
  575. #endif
  576.  
  577. /* Define global veriables that refer to values exported by the scanner.
  578.  * These declarations duplicate those in dlgdef.h, but are needed
  579.  * if ANTLR is not to generate a .dlg file (-gx); PS, this is a hack.
  580.  */
  581. extern zzchar_t *zzlextext;     /* text of most recently matched token */
  582. extern int      zzbufsize;      /* how long zzlextext is */
  583.  
  584. #endif
  585.